import { defineStore } from "pinia";
import { get, post } from "@/utils/request";
import {ref} from 'vue'

export const useMentorBasicStore = defineStore('mBasic',() => {
  let mBasicProceedData = ref(null)
  let mBasicFinishData = ref(null)
  // 基本工作进行中表单数据
  const mBasicProceedRequest = async () => {
    try{
      const response = await get('/teacher/questionnaire/underway')
      console.log(response)
        mBasicProceedData.value = response.data.list
        console.log(mBasicProceedData.value)
      // }
    }catch(error){
      console.error(error)
    }
  }

  // 基本工作进行中数据上传
  const mBProceedDetailRequest = async (mBPDetailData) => {
    try{
      const response = await post('/teacher/basework/getdetails',{
        mBPDetailData
      })
      if(response.code == 200){

      }
    }catch(error){
      console.error(error)
    }
  }


  // 基本工作已完成表单数据
  const mBasicFinishRequest = async () => {
    try{
      const response = await get('/teacher/questionnaire/over')
      console.log(response)
      // if(response.code == 200) {
        mBasicFinishData.value = response.data.list
      // }
    }catch(error){
      console.error(error)
    }
  }

  // 基本工作已完成详情页
  let mBFDetailData = ref(null)
  const mBFDetailRequest = async (questionnaireId) => {
    try {
      const response = await post('/teacher/questionnaire/detail',{
        // 这里值要改
        questionnaireId:1
      })
    } catch (error) {
      console.error(error)
    }
  }


  return {mBasicProceedData,mBasicProceedRequest,mBasicFinishData,mBasicFinishRequest,
    mBProceedDetailRequest,mBFDetailData,mBFDetailRequest
  }
})